<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="<?php echo site_url("style.css"); ?>" type="text/css" />
<title>Reviews</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
	<!-- header starts here -->
<div id="header">
  <div id="header-content"> 
    <ul>
      <li><a href="<?php echo site_url("admin/login/"); ?>">Login</a></li>
    </ul>
  </div>
</div>

<div id="content-wrap">
	
	<div id="nav">
		<img src="<?php echo site_url("images/Nav_Head_Post.png"); ?>" alt="navigation header" class="no-border" />
		<a href="<?php echo site_url("review"); ?>"><img src="<?php echo site_url("images/Home_Off.png"); ?>" alt="home" class="no-border" /></a>
		<a href="<?php echo site_url("review/reviews/default/0/A"); ?>"><img src="<?php echo site_url("images/Reviews_On.png"); ?>" alt="reviews" class="no-border" /></a>
		<img src="<?php echo site_url("images/Nav2b.png"); ?>" alt="nav3" class="no-border" />
	</div>
		
	<div id="main_display">
		<div id="reviewlist">				
			<div id="reviewlistwrapper">
				<table width="100%">
				
<?php
	
	$start = $id;
	$end = $start + 25;
	if ($start >= 25) {
		$prev = $start - 25;
	} else {
		$prev = 0;
	}
	$url = site_url("review/");
	if (strcmp($cat, 'default') == 0) {
		if ($s == 'A') {
			echo"<tr><td width=\"75%\">&nbsp;&nbsp;&nbsp;<b><a href=\"$url/reviews/default/0/D\">Series</a></b></td><td><b><a href=\"$url/reviews/date/0/A\">Season</a></b></td></tr>";
		} else {
			echo"<tr><td width=\"75%\">&nbsp;&nbsp;&nbsp;<b><a href=\"$url/reviews/default/0/A\">Series</a></b></td><td><b><a href=\"$url/reviews/date/0/A\">Season</a></b></td></tr>";
		}
		
		$cnt = 0;
				// Fetch and print all the records.
		foreach($list as $row) {
			
			$title = htmlspecialchars($row->name);
			echo "<tr><td width=\"75%\"><a href=\"$url/series/$row->series\">$title</a></td><td>$row->season $row->year</td></tr>";
			$cnt++;
		}
			
		
		if($cnt == 25) {
			echo "</table>
			<div id=\"listnav\"><p>";
			if ($start > 0) {
				echo"<a href=\"$url/reviews/default/$prev/$s\">Previous 25 reviews</a> &nbsp;&nbsp;&nbsp;";
			} else {
				echo"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			}
			echo"||&nbsp;&nbsp;&nbsp; <a href=\"$url/reviews/default/$end/$s\">Next 25 reviews</a></p></div>";
		} else if ($start > 0) {
			echo "</table>
		<div id=\"listnav\"><p><a href=\"$url/reviews/default/$prev/$s\">Previous 25 reviews</a> &nbsp;&nbsp;&nbsp;||</p></div>";
		} else {
			echo"</table>";
		}
		
	} else if (strcmp($cat, 'date') == 0) {
		if ($s == 'A') {
			echo"<tr><td width=\"75%\">&nbsp;&nbsp;&nbsp;<b><a href=\"$url/reviews/default/0/A\">Series</a></b></td><td><b><a href=\"$url/reviews/date/0/D\">Season</a></b></td></tr>";
		} else {
			echo"<tr><td width=\"75%\">&nbsp;&nbsp;&nbsp;<b><a href=\"$url/reviews/default/0/A\">Series</a></b></td><td><b><a href=\"$url/reviews/date/0/A\">Season</a></b></td></tr>";
		}
		
		$cnt = 0;					
				// Fetch and print all the records.
		foreach($list as $row) {
			
			$title = htmlspecialchars($row->name);
			echo "<tr><td width=\"75%\"><a href=\"$url/series/$row->series\">$title</a></td><td>$row->season $row->year</td></tr>";
			$cnt++;
		}
			
		if ($cnt == 25) {
			echo "</table>
			<div id=\"listnav\"><p>";
			if ($start > 0) {
				echo"<a href=\"$url/reviews/date/$prev/$s\">Previous 25 reviews</a> &nbsp;&nbsp;&nbsp;";
			} else {
				echo"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			}
			echo"||&nbsp;&nbsp;&nbsp; <a href=\"$url/reviews/date/$end/$s\">Next 25 reviews</a></p></div>";
		} else if ($start > 0) {
			echo "</table>
			<div id=\"listnav\"><p><a href=\"$url/reviews/date/$prev/$s\">Previous 25 reviews</a> &nbsp;&nbsp;&nbsp;||</p></div>";
		} else {
			echo"</table>";
		}
		
		
	} else {
		echo"<tr><td width=\"75%\">&nbsp;&nbsp;&nbsp;<b><a href=\"$url/reviews/default/0/A\">Series</a></b></td><td><b><a href=\"$url/reviews/date/0/A\">Season</a></b></td></tr></table>";
	}
?>
			</div>
		</div>
		<div id="reviewlistfooter"></div>
			
<div id="footer"><p>&copy;2010 Kevin Baumgardner</p></div>			
		</div>
	
	</div>

</div>
</body>
</html>
